import { MemberEntity } from "../model/member";

// <MemberEntity[]> - 类型占位符 - 数组的每一项，都是一个Entity
// (): Promise<MemberEntity[]> 对函数返回值做类型约束
export const getMembersCollection = (): Promise<MemberEntity[]> => {
    const promise = new Promise<MemberEntity[]>((resolve, reject) => {
        setTimeout(() => {
            resolve([
                {
                    id: 1457912,
                    login: "brauliodiez",
                    avatar_url: "https://avatars.githubusercontent.com/u/1457912?v=3"
                },
                {
                    id: 4374977,
                    login: "Nasdan",
                    avatar_url: "https://avatars.githubusercontent.com/u/4374977?v=3"
                }
            ])
        }, 500)
    })
    return promise;
}